package com.cal.utms.entity;

import java.io.Serializable;

import javax.persistence.*;

import com.cal.utms.enumType.DepositType;
import com.cal.utms.enumType.FundTransferType;
import com.cal.utms.logAudit.AuditLogInt;
import com.cal.utms.util.ValueConvert;

import java.math.BigDecimal;
import java.util.Date;

/**
 * The persistent class for the customer_investment database table.
 * 
 */
@Entity
@Table(name = "customer_investment")
@NamedQuery(name = "CustomerInvestment.findAll", query = "SELECT c FROM CustomerInvestment c")
public class CustomerInvestment implements Serializable, AuditLogInt {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(name = "AMOUNT")
	private BigDecimal amount;

	@Column(name = "BRANCH")
	private String branch;

	@Temporal(TemporalType.DATE)
	@Column(name = "CHEQUE_DATE")
	private Date chequeDate;

	@Column(name = "CHEQUE_NO")
	private String chequeNo;

	@Column(name = "DEPOSIT_TO")
	@Enumerated(EnumType.STRING)
	private DepositType depositTo;

	@Column(name = "FULL_REDEMPTION")
	private byte fullRedemption;

	@Temporal(TemporalType.DATE)
	@Column(name = "FULL_REDEMPTION_DATE")
	private Date fullRedemptionDate;

	@Column(name = "FUND_TRANSFER_TYPE")
	@Enumerated(EnumType.STRING)
	private FundTransferType fundTransferType;

	@Column(name = "INVESTMENT_CODE")
	private String invenstmentCode;

	@Temporal(TemporalType.DATE)
	@Column(name = "ISSUED_DATE")
	private Date issuedDate;

	@Column(name = "ISSUED_UNIT_PRICE")
	private BigDecimal issuedUnitPrice;

	@Temporal(TemporalType.DATE)
	@Column(name = "MON_INT_LAST_PAID_DATE")
	private Date monIntLastPaidDate;

	@Temporal(TemporalType.DATE)
	@Column(name = "MON_INT_NEXT_DATE")
	private Date monIntNextDate;

	@Temporal(TemporalType.DATE)
	@Column(name = "MON_INT_START_DATE")
	private Date monIntStartDate;

	@Column(name = "MONTHLY_INTEREST_REQUIRED")
	private byte monthlyInterestRequired;

	@Column(name = "NAME_OF_BANK")
	private String nameOfBank;

	@Column(name = "NO_OF_ISSUED_UNIT")
	private BigDecimal noOfIssuedUnit;

	@Column(name = "BALANCE_UNITS")
	private BigDecimal balanceUnits;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "RECODE_DATE")
	private Date recodeDate;

	@Temporal(TemporalType.DATE)
	@Column(name = "REQUEST_DATE")
	private Date requestDate;

	@Column(name = "STATUS")
	private String status;

	@ManyToOne
	@JoinColumn(name = "CUSTOMER_ID")
	private Customer customer;

	@ManyToOne
	@JoinColumn(name = "ACCOUNT_NO")
	private CustomerBankAccount customerBankAccount;

	@ManyToOne
	@JoinColumn(name = "FUND_ID")
	private Fund fund;

	@ManyToOne
	@JoinColumn(name = "RECODE_USER")
	private User recodeUser;

	@ManyToOne
	@JoinColumn(name = "ISSUED_USER")
	private User issuedUser;

	@Column(name = "POST_UNIT_CERT")
	private String postStatus;

	@Column(name = "POST_ADDRESS")
	private String postAddress;

	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "RECEIPT_NO")
	private Receipt receipt;

	@Column(name = "INTEREST_TYPE")
	private String interestType;

	@Column(name = "INSTRUCTIONS")
	private String instructions;

	public CustomerInvestment() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public BigDecimal getAmount() {
		return this.amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public String getBranch() {
		return this.branch;
	}

	public void setBranch(String branch) {
		this.branch = branch;
	}

	public Date getChequeDate() {
		return this.chequeDate;
	}

	public void setChequeDate(Date chequeDate) {
		this.chequeDate = chequeDate;
	}

	public String getChequeNo() {
		return this.chequeNo;
	}

	public void setChequeNo(String chequeNo) {
		this.chequeNo = chequeNo;
	}

	public DepositType getDepositTo() {
		return this.depositTo;
	}

	public void setDepositTo(DepositType depositTo) {
		this.depositTo = depositTo;
	}

	public byte getFullRedemption() {
		return this.fullRedemption;
	}

	public void setFullRedemption(byte fullRedemption) {
		this.fullRedemption = fullRedemption;
	}

	public Date getFullRedemptionDate() {
		return this.fullRedemptionDate;
	}

	public void setFullRedemptionDate(Date fullRedemptionDate) {
		this.fullRedemptionDate = fullRedemptionDate;
	}

	public FundTransferType getFundTransferType() {
		return this.fundTransferType;
	}

	public void setFundTransferType(FundTransferType fundTransferType) {
		this.fundTransferType = fundTransferType;
	}

	public String getInvenstmentCode() {
		return this.invenstmentCode;
	}

	public void setInvenstmentCode(String invenstmentCode) {
		this.invenstmentCode = invenstmentCode;
	}

	public Date getIssuedDate() {
		return this.issuedDate;
	}

	public void setIssuedDate(Date issuedDate) {
		this.issuedDate = issuedDate;
	}

	public BigDecimal getIssuedUnitPrice() {
		return this.issuedUnitPrice;
	}

	public void setIssuedUnitPrice(BigDecimal issuedUnitPrice) {
		this.issuedUnitPrice = issuedUnitPrice;
	}

	public Date getMonIntLastPaidDate() {
		return this.monIntLastPaidDate;
	}

	public void setMonIntLastPaidDate(Date monIntLastPaidDate) {
		this.monIntLastPaidDate = monIntLastPaidDate;
	}

	public Date getMonIntNextDate() {
		return this.monIntNextDate;
	}

	public void setMonIntNextDate(Date monIntNextDate) {
		this.monIntNextDate = monIntNextDate;
	}

	public Date getMonIntStartDate() {
		return this.monIntStartDate;
	}

	public void setMonIntStartDate(Date monIntStartDate) {
		this.monIntStartDate = monIntStartDate;
	}

	public byte getMonthlyInterestRequired() {
		return this.monthlyInterestRequired;
	}

	public void setMonthlyInterestRequired(byte monthlyInterestRequired) {
		this.monthlyInterestRequired = monthlyInterestRequired;
	}

	public String getNameOfBank() {
		return this.nameOfBank;
	}

	public void setNameOfBank(String nameOfBank) {
		this.nameOfBank = nameOfBank;
	}

	public BigDecimal getNoOfIssuedUnit() {
		return this.noOfIssuedUnit;
	}

	public void setNoOfIssuedUnit(BigDecimal noOfIssuedUnit) {
		this.noOfIssuedUnit = noOfIssuedUnit;
	}

	public Date getRecodeDate() {
		return this.recodeDate;
	}

	public void setRecodeDate(Date recodeDate) {
		this.recodeDate = recodeDate;
	}

	public Date getRequestDate() {
		return this.requestDate;
	}

	public void setRequestDate(Date requestDate) {
		this.requestDate = requestDate;
	}

	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Customer getCustomer() {
		return this.customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public CustomerBankAccount getCustomerBankAccount() {
		return this.customerBankAccount;
	}

	public void setCustomerBankAccount(CustomerBankAccount customerBankAccount) {
		this.customerBankAccount = customerBankAccount;
	}

	public Fund getFund() {
		return this.fund;
	}

	public void setFund(Fund fund) {
		this.fund = fund;
	}

	public User getRecodeUser() {
		return this.recodeUser;
	}

	public void setRecodeUser(User recodeUser) {
		this.recodeUser = recodeUser;
	}

	public User getIssuedUser() {
		return this.issuedUser;
	}

	public void setIssuedUser(User issuedUser) {
		this.issuedUser = issuedUser;
	}

	public String getPostStatus() {
		return postStatus;
	}

	public void setPostStatus(String postStatus) {
		this.postStatus = postStatus;
	}

	public String getPostAddress() {
		return postAddress;
	}

	public void setPostAddress(String postAddress) {
		this.postAddress = postAddress;
	}

	public BigDecimal getBalanceUnits() {
		return balanceUnits;
	}

	public void setBalanceUnits(BigDecimal balanceUnits) {
		this.balanceUnits = balanceUnits;
	}

	public Receipt getReceipt() {
		return receipt;
	}

	public void setReceipt(Receipt receipt) {
		this.receipt = receipt;
	}

	public String getInterestType() {
		return interestType;
	}

	public void setInterestType(String interestType) {
		this.interestType = interestType;
	}

	public String getInstructions() {
		return instructions;
	}

	public void setInstructions(String instructions) {
		this.instructions = instructions;
	}

	@Transient
	@Override
	public Long getLogId() {
		return ValueConvert.toLong(this.id);
	}

	@Transient
	@Override
	public String getLogDeatil() {
		StringBuilder sb = new StringBuilder();
		sb.append("Investment Id : ").append(id).append(" Investment Code : ").append(invenstmentCode);

		return sb.toString();
	}

}